<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<base href="<%=basePath%>">
<html lang="zn-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>登录</title>
    <link rel="stylesheet" href="css/service.css">
    <link rel="stylesheet" href="css/base.css">

</head>
<body>
<div class="wrap por height_98">
    <div class="wrapper">
        <div class="top_layer">
            <img src="img/logo.png">
            <p>电话群</p>
        </div>
        <div class="input_box">
            <form action="user/login" class="form" id="frm1",method="post">
                <input type="hidden" name="code" id="code" value="${code}">
                <input type="hidden" name="openid" id="openid" value="${openid}">
                <input type="hidden" name="url" id="url" value="${url}">
                <p class="idbox por">
                    <img src="img/id.png">
                    <input type="text" maxlength="50" name="username" id="username" placeholder="请输入账户" class="id">
                </p>
                <p class="pswbox por">
                    <img src="img/key.png">
                    <input type="password" placeholder="暂无密码"  id="password" class="psw" minlength="8"
                           maxlength="16">
                </p>
            </form>
        </div>
        <div class="login_btn">登录</div>
        <p class="addition">
            <a href="wxmp/user/toRegisterPage">
                <span class="register">注册</span>
            </a>
            <a href="wxmp/user/toResetPSWPage">
                <span class="forgetpsw">忘记密码</span>
            </a>
        </p>
    </div>
    <div class="bottomLogo">
        <p>本服务由 @好好de浩浩 提供</p>
        <p>联系电话：17090077783</p>
    </div>
</div>
<div class="mask_layer none"></div>
<div class="toast toast_timeout" style="display:none">网络异常，请稍后重试！</div>
<div class="toast toast_error" style="display:none">信息输入有误</div>
<div class="loading" style="display:none">
    <img src="img/loading.gif"></div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/md5.js"></script>
<script type="text/javascript" src="js/base.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/handle.js"></script>
<script type="text/javascript" src="js/ask.js"></script>
<script type="text/javascript">
    var code = GetQueryString("code");
    var cacheTel = sessionStorage.getItem("tel");
    if (cacheTel == "" || cacheTel == null) {
        cacheTel = '${utel}';
    }
    $(function () {

        var err = '${err}';
        if (err != "") {
            errorToast(err, 3);
        }

        if (cacheTel != "" || cacheTel != null) {
            $(".id").val(cacheTel);
        }

        /*$(".id").on('input', function (e) {
            var input = $(this).val().replace(/\W+/ig, "");
            $(this).val(input);
        });*/

        $(".addition").on('click', function (e) {
            $(".psw").val("");
            $(".id").val("");
        });

        $(".login_btn").on('click', function (e) {
            var psw = $(".psw").val();
            var username = $('[name="username"]').val();
            var id = $(".id").val();
            var reg = /\D/ig;//非数字
            var reg2 = /^(((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[6])|(17[0135678])|(18[0-9])|(19[89]))\d{8})$/;//仅为数字和英文字母组合
            $("input").blur();
          /*  if (reg.test(id) || id.length != 11) {
                errorToast("请输入11位手机号", 3);
                return false;
            }*/
            /*if (psw.length < 8 || psw.length > 16 || !reg2.test(psw)) {
                errorToast("请输入正确的密码", 3);
                return false;
            }*/
            if (!reg2.test(username)) {
                psw = hex_md5(psw) + "http://haois.me";
            }
            loginSubmit(username, psw);
//            $("#frm1").submit();
        });
    })
    // 请求登录

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="js/weixin.js"></script>
<script type="text/javascript">
    getSignature([],function () {
        shareMobileGroup("${fromUser}");
    })
</script>
</body>

</html>